const app = getApp()
Component({
  data: {
    selected: 0,
    color: "#C4C4C4",
    hasShop: false,
    selectedColor: "#FF5555",
    list: [
      {
        pagePath: "/pages/itemlist/itemlist",
        iconPath: "/img/new/home_menu@3x.png",
        selectedIconPath: "/img/new/home_sel_menu@3x.png",
        text: "首页"
      }, 
      {
        pagePath: "/pages/classification/classification",
        iconPath: "/img/new/class_menu@3x.png",
        selectedIconPath: "/img/new/class_sel_menu@3x.png",
        text: "分类"
      },
      {
        pagePath: "/pages/myStore/myStore",
        iconPath: "/img/new/oshop_menu@3x.png",
        selectedIconPath: "/img/new/shop_sel_menu@3x.png",
        text: "我的小店"
      },
      {
        pagePath: "/pages/promotionTool/promotionTool",
        iconPath: "/img/new/tools_menu@3x.png",
        selectedIconPath: "/img/new/tools_sel_menu@3x.png",
        text: "推广工具"
      },
      {
        pagePath: "/pages/usercenter/usercenter",
        iconPath: "/img/new/vip_menu@3x.png",
        selectedIconPath: "/img/new/vip_sel_menu@3x.png",
        text: "会员"
      }
    ]
  },
  attached() {
  },
  methods: {
    switchTab(e) {
      const that = this
      console.log(e)
      const data = e.currentTarget.dataset
      const url = data.path
      wx.switchTab({
        url: url,
        success: function (res) {
          that.setData({
            selected: data.index
          })
        },
        fail: function (res) {
          console.log(res)
        }
      })
    }
  }
})